/*
 * Proto Streamer
 * Copyright (C) 2009 John Pritchard.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 */
package p.s.m;

/**
 * A consumer is a down link, typically an HTTP GET.
 * 
 * A consumer is a response method that attaches to a service, and
 * pulls update messages from it's service and writes them to its
 * output stream to the client.
 * 
 * <h3>Consumer pointer</h3>
 * 
 * The consumer pointer has different meanings for the {@link
 * p.s.q.Queue} or the {@link p.s.t.Map}.  For the {@link p.s.q.Queue} it
 * is a position offset, while for the {@link p.s.t.Map} it is a slot
 * version.
 * 
 * @author jdp
 */
public interface Consumer 
    extends p.s.Response
{
    /**
     * @return A non null unique identifier for this consumer to
     * differentiate it from other consumers.
     */
    public Object getConsumerIdentity();
    /**
     * @return For a known service and version, the last pointer
     * value.  Otherwise zero.
     */
    public int getServicePointer(int service, long version);
    /**
     * Save the pointer for a service and version.
     */
    public void setServicePointer(int service, long version, int pointer);
}
